package org.example.v4.action;

import org.example.v4.OrderStateFactory;
import org.example.v4.OrderStateMachine;
import org.example.v4.enums.Event;
import org.example.v4.enums.OrderState;

/**
 * ShippedStateAction 类表示订单的已发货状态。
 */
public class ShippedStateAction extends AbstractOrderStateAction {
    @Override
    protected void handleInternal(OrderStateMachine context, Event event) {
        System.out.println("订单已发货。");
    }

    @Override
    protected boolean isValidEvent(Event event) {
        return event == Event.DELIVER;
    }

    @Override
    protected void nextState(OrderStateMachine context) {
        context.setStateAction(OrderStateFactory.getState(OrderState.DELIVERED));
    }
}